package cate.common.table.farm.island.sheet;

import cate.common.table.ESheet;
import cate.common.table.farm.island.row.IslandGuardGroupRow;
import cate.common.util.XT;

import java.util.List;
import java.util.stream.Collectors;

public class IslandGuardGroupSheet extends ESheet<IslandGuardGroupRow> {

    @Override
    public String getSheetName() {
        return "迷失神庙守卫分组";
    }

    public IslandGuardGroupRow randomOne(int group){
        List<IslandGuardGroupRow> list = getList().stream().filter(e -> e.group == group).collect(Collectors.toList());
        if(!list.isEmpty()){
            return list.get(XT.randomIndex(list.size()));
        }
        return null;
    }
}
